//
// Created by 11510 on 2024/6/17.
//

#ifndef DEMO1_CYLINDER_H
#define DEMO1_CYLINDER_H
#include "Circle.h"


class Cylinder: public Circle {
private:
    double height;

public:
    //创建Circle对象时将半径初始化为r
    Cylinder(double r, double h):Circle(r), height(h){}

    //获取圆柱体的体积
    double getVolume(){
        return getArea() * height;
    }

    //将圆柱体的体积输出到屏幕
    void showVolume(){
        printf("Volume = %lf\n", getVolume());
    }

};
#endif //DEMO1_CYLINDER_H
